﻿/*-----------------------------------------------
// File: TableConvertUtil.cs
// Description: 针对字典数据读取字段进行需要的类型转换
// Author: Shaobing	492057342@qq.com
-----------------------------------------------*/
using UnityEngine;
using System.Collections;

public class TableConvertUtil
{
    public static Vector3 String2Vector3(string args) {
        var arr = args.Split(',');
        if (arr.Length == 3) {
            float x, y, z;
            if (!float.TryParse(arr[0], out x)) { x = 0f; }
            if (!float.TryParse(arr[1], out y)) { y = 0f; }
            if (!float.TryParse(arr[2], out z)) { z = 0f; }
            return new Vector3(x, y, z);
        }
        return Vector3.zero;
    }
}